package gameEngine;

import player.Player;

public class RockPaperScissors {

	public RockPaperScissors() {

	}

	public Result play(RPSEnum p1, RPSEnum p2) {
		Result r = Result.TIE;

		switch(p1) {
		case PAPER:
			switch(p2) {
			case PAPER:
				r = Result.TIE;
				break;
			case ROCK:
				r = Result.WIN;
				break;
			case SCISSORS:
				r = Result.LOST;
				break;
			default:
				break;
			}
			break;
		case ROCK:
			switch(p2) {
			case PAPER:
				r = Result.LOST;
				break;
			case ROCK:
				r = Result.TIE;
				break;
			case SCISSORS:
				r = Result.WIN;
				break;
			default:
				break;
			}
			break;
		case SCISSORS:
			switch(p2) {
			case PAPER:
				r = Result.WIN;
				break;
			case ROCK:
				r = Result.LOST;
				break;
			case SCISSORS:
				r = Result.TIE;
				break;
			default:
				break;
			}
			break;
		default:
			break;
		}
		return r;
	}
	
	private Result play(Player p1, Player p2) {
		return Result.LOST;
	}
}
